<include file="Public:head"/>
<link rel="stylesheet" href="{lanrain::STATICS}/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="{lanrain::STATICS}/kindeditor/plugins/code/prettify.css" />
<script src="{lanrain::STATICS}/kindeditor/kindeditor.js" type="text/javascript"></script>
<script src="{lanrain::STATICS}/kindeditor/lang/zh_CN.js" type="text/javascript"></script>
<script src="{lanrain::STATICS}/kindeditor/plugins/code/prettify.js" type="text/javascript"></script>
<script>
	KindEditor.ready(function(K){
		var editor = K.editor({
			allowFileManager:true
		});
        
		K('#upload').click(function() {
			editor.loadPlugin('image', function() {
				editor.plugin.imageDialog({
					fileUrl : K('#pic').val(),
					clickFn : function(url, title) {
						if(url.indexOf("http") > -1){
							K('#pic').val(url);
						}else{
							K('#pic').val('__ROOT__'+url);
						}
						editor.hideDialog();
					}
				});
			});
		});
		
		K.create('#info', {
			uploadJson : '{lanrain::STATICS}/kindeditor/php/upload_json2.php',
		});
		
		
	});

	$(function(){
    	$('#free').change(function(){
        	if($(this).val()==2)
        	{
        	  	$('#address_form').show();
        	}
        	else
        	{
        	  	$('#address_form').hide();
        	}
        });
        set_address();
    })
        
    function set_address()
    {
        var addr_id =$("#free").find("option:selected").val();
        if(addr_id == 2)
        {
            $('#address_form').show();
        }
        else
        {
            $('#address_form').hide();
        }
    }

	function save(){
		//alert('save');
		document.getElementById("info_form").action="{lanrain::U('Wetall_import/edit')}";   
		document.getElementById("info_form").submit();
	}
	function saveasitem(){
		//alert('saveasitem');
		document.getElementById("info_form").action="{lanrain::U('Wetall_item/edit',array('flag'=>'import'))}";   
		document.getElementById("info_form").submit();
	}
	
</script>
<div class="content" style="width:920px; background:none; margin-left:275px; border:none; margin-bottom:30px;" >
	<div class="cLineB"><h4>商品{lanrain:$myaction}</h4><a href="javascript:history.go(-1);"  class="right btnGrayS vm" style="margin-top:-27px" >返回</a></div> 
	<div class="msgWrap">
	<form id="info_form" class="form" method="post" action="">
	<input type="hidden" name="id" value="{lanrain:$info.id}" />
	<TABLE class="userinfoArea" style=" margin:20px 0 0 0;" border="0" cellSpacing="0" cellPadding="0" width="100%">
	<TBODY>
		<tr>
			<th>商品名称：</th>
			<td><input type="text" required="" class="px" name="title" value="{lanrain:$info.title}" style="width:500px"></td>
		</tr>			
		<tr>
			<th>商品简介：</th>
			<td><textarea name="intro" class="px" style="width:500px; height:50px;">{lanrain:$info.intro}</textarea></td>
		</tr>
		<tr>
			<th>所属分类：</th>
			<td><select name="cate_id" class="pt" required="" style="width:250px">
				<option value="">--请选择--</option>
				<volist name='cate_list' id='vo' >
				<option value="{lanrain:$key}" <eq name="key" value="$info['cate_id']">selected="selected"</eq> >{lanrain:$vo}</option>
				</volist>
				</select>
			</td>
		</tr>
		<tr>
			<th>所属品牌：</th>
			<td><select name="brand" class="pt" required="" style="width:250px">
				<option value="">--请选择--</option>
				<volist name='brand_list' id='vo' >
				<option value="{lanrain:$key}" <eq name="key" value="$info['brand']">selected="selected"</eq> >{lanrain:$vo}</option>
				</volist>
				</select>
			</td>
		</tr>
		<tr>
			<th>商品图片：</th>
			<td>
				<input type='text' class='px' id='pic' value='{lanrain:$info.img}' name='img' style='width:500px' readonly='readonly'><span class='ke-button-common' id='upload' style='margin-top: 3px;margin-left: 5px;'><input type='button' class='ke-button-common ke-button' value='上传'></span><br />
			</td>
		</tr>
		<tr>
			<th>型号：</th>
			<td>
				<input type="text" class="px" name="size" value="{lanrain:$info.size}" style="width:500px"><br/>多个型号请以“|”号分隔，例如：大号|中号|小号
			</td>
		</tr>
		<tr>
			<th>颜色：</th>
			<td>
				<input type="text" class="px" name="color" value="{lanrain:$info.color}" style="width:500px"><br/>多种颜色请以“|”号分隔，例如：红色|蓝色|黄色
			</td>
		</tr>
		<tr>
			<th>商品价格：</th>
			<td><input onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')" type="text" id="price" name="price" class="px" value="{lanrain:$info.price}" style="width:250px"> 元</td>
		</tr>
		<tr>
			<th>商品库存：</th>
			<td><input onkeyup="this.value=this.value.replace(/\D/g,'')" type="text" id="goods_stock" name="goods_stock" class="px" value="{lanrain:$info.goods_stock}" style="width:250px"> </td>
		</tr>
		<tr>
			<th>是否推荐：</th>
			<td>
			<input type="checkbox" name="news" <eq name="info.news" value="1">checked</eq> >新品
			&nbsp;
			<input type="checkbox" name="tuijian" <eq name="info.tuijian" value="1">checked</eq> >推荐
			</td>
		</tr>
		<tr>
			<th>运费：</th>
			<td>
				<select id='free' name="free">
				<option value="1" <eq name="info.free" value="1">selected="selected"</eq> >卖家承担运费</option>
				<option value="2" <eq name="info.free" value="2">selected="selected"</eq> >买家承担运费</option>
				</select>
			</td>
		</tr>
		<tr id="address_form" style="display:none;">
			<th></th>
			<td>
			平邮：<input onkeyup="value=value.replace(/[^\d\.]/g,'')" type="text" name="pingyou" class="px" value="{lanrain:$info.pingyou}"/>
			快递：<input onkeyup="value=value.replace(/[^\d\.]/g,'')" type="text" name="kuaidi" class="px" value="{lanrain:$info.kuaidi}"/>
			EMS：<input onkeyup="value=value.replace(/[^\d\.]/g,'')" type="text" name="ems" class="px" value="{lanrain:$info.ems}"/>
		    </td>
		</tr>
		<tr>
			<th>商品详情：</th>
			<td><textarea class="px" name="info" id="info" style="width:90%;height:400px;">{lanrain:$info.info}</textarea></td>
		</tr>
		<TR>
			<TH></TH>
			<TD>
			<a class="btnGreen left" href="javascript:save();">保存</a>&nbsp;&nbsp;
			<a class="btnGreen" href="javascript:saveasitem();">保存为正式商品</a>
	  		<div class="clr"></div>
	  		</TD>
		</TR>
	</TBODY>
	</TABLE>
	</form>
	</div> 
</div>
<include file="Public:footer"/>